--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\Ch7.log
  log type:  text
 opened on:  12 Jul 2023, 12:55:02

. 
.         ******************************
.         **** Set directory, seed *****
.         ******************************
.                 set more off 

.                 set matsize 1000
set matsize ignored.
    Matrix sizes are no longer limited by c(matsize) in modern Statas.  Matrix sizes are now limited by edition of
    Stata.  See limits for more details.

.                 global seed ="984353"

.                 set scheme plotplain

.                 cd "$dir"
C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction

. 
.                 ***********************************
.                 **** Party leader funding trends ****
.                 *************************************
.                 use pers-use,clear

.                 gen pubfin = l1v2elpubfin_ord==3 | l1v2elpubfin_ord==4 if l1v2elpubfin_ord~=.
(1 missing value generated)

.                 qui sum v2pafunds_6

.                 local m = r(mean)

.                 twoway (lpoly v2pafunds_6 year,lpat(solid)ylab(.1(.02).2)yline(`m',lcol(red)) legend(off) ///
>                         ytit(Share of leaders who fund their own party)xtit(Year)xlab(1990(5)2020))

.                 gr export "$dir\golden\T-Rising-Leader-Funding.pdf",as(pdf)replace 
file C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\golden\T-Rising-Leader-Funding.pdf saved
    as PDF format

.                 table period, stat(min year)  stat(max year) stat(mean v2pafunds_6)  nformat(%5.2f)

------------------------------------------------------------
        |  Minimum value   Maximum value                Mean
        |           year            year   Party resources 6
--------+---------------------------------------------------
period  |                                                   
  1     |        1991.00         1995.00                0.13
  2     |        1996.00         2000.00                0.16
  3     |        2001.00         2005.00                0.17
  4     |        2006.00         2010.00                0.17
  5     |        2011.00         2015.00                0.19
  6     |        2016.00         2020.00                0.19
  Total |        1991.00         2020.00                0.17
------------------------------------------------------------

.                 
.                 /*
> period  |                                                   
>   1     |        1991.00         1995.00                0.13
>   2     |        1996.00         2000.00                0.16
>   3     |        2001.00         2005.00                0.17
>   4     |        2006.00         2010.00                0.17
>   5     |        2011.00         2015.00                0.19
>   6     |        2016.00         2020.00                0.19
>                 */ 
.                 ttest v2pafunds_6 if year==min,by(create)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       0 |     386    .1371503    .0129433    .2542946    .1117019    .1625986
       1 |     144    .2590139    .0278543    .3342511    .2039546    .3140732
---------+--------------------------------------------------------------------
Combined |     530    .1702604    .0123019     .283211    .1460938     .194427
---------+--------------------------------------------------------------------
    diff |           -.1218636    .0271684                -.175235   -.0684923
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =  -4.4855
H0: diff = 0                                     Degrees of freedom =      528

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000

.                 ttest pubfin if year==min,by(create)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       0 |     409    .6185819    .0240475    .4863297    .5713095    .6658543
       1 |     168    .3690476    .0373406    .4839895    .2953272    .4427681
---------+--------------------------------------------------------------------
Combined |     577    .5459272    .0207453    .4983182    .5051816    .5866728
---------+--------------------------------------------------------------------
    diff |            .2495343    .0445037                .1621247    .3369439
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   5.6070
H0: diff = 0                                     Degrees of freedom =      575

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 1.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 0.0000

.                 reg create v2pafunds_6 if year==min,cluster(cowcode)

Linear regression                               Number of obs     =        530
                                                F(1, 99)          =      11.66
                                                Prob > F          =     0.0009
                                                R-squared         =     0.0367
                                                Root MSE          =     .43742

                              (Std. err. adjusted for 100 clusters in cowcode)
------------------------------------------------------------------------------
             |               Robust
      create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
 v2pafunds_6 |   .3012119   .0882018     3.42   0.001     .1262004    .4762234
       _cons |   .2204137   .0306822     7.18   0.000     .1595335    .2812938
------------------------------------------------------------------------------

.                 reg create pubfin if year==min,cluster(cowcode)

Linear regression                               Number of obs     =        577
                                                F(1, 103)         =      16.79
                                                Prob > F          =     0.0001
                                                R-squared         =     0.0518
                                                Root MSE          =     .44313

                              (Std. err. adjusted for 104 clusters in cowcode)
------------------------------------------------------------------------------
             |               Robust
      create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      pubfin |  -.2077548   .0506986    -4.10   0.000    -.3083034   -.1072061
       _cons |   .4045802   .0383303    10.56   0.000      .328561    .4805993
------------------------------------------------------------------------------

. 
.                 ************************************************************************************
.                 *** Publicly financed campaigns reduce likelihood of personalist party selection ***
.                 ************************************************************************************
.                 use pers-use,clear

.                 table year,stat(n l1v2smpardom)

--------------------------------------
        |  Number of nonmissing values
--------+-----------------------------
year    |                             
  1991  |                            0
  1992  |                            0
  1993  |                            0
  1994  |                            0
  1995  |                            0
  1996  |                            0
  1997  |                            0
  1998  |                            0
  1999  |                            0
  2000  |                            0
  2001  |                           80
  2002  |                           81
  2003  |                           80
  2004  |                           80
  2005  |                           80
  2006  |                           83
  2007  |                           83
  2008  |                           84
  2009  |                           87
  2010  |                           84
  2011  |                           85
  2012  |                           87
  2013  |                           86
  2014  |                           87
  2015  |                           90
  2016  |                           92
  2017  |                           90
  2018  |                           91
  2019  |                           91
  2020  |                           88
  Total |                        1,709
--------------------------------------

.                 gen pubfin = l1v2elpubfin_ord==3 | l1v2elpubfin_ord==4 if l1v2elpubfin_ord~=. & l1v2elpubfin_ord~=
> 2
(409 missing values generated)

.                 gen proportional= v2elparlel==1 | v2elparlel==3

.                 qui gen wealth=e_migdppcln

.                 qui xi:reg e_migdppcln i.cowcode i.year 

.                 qui predict hat

.                 replace wealth=hat if wealth==.
(189 real changes made)

.                 hist wealth
(bin=33, start=6.1592889, width=.15729429)

.                 sum wealth e_migdppcln

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      wealth |      2,392    9.213885    1.132266   6.159289      11.35
 e_migdppcln |      2,203    9.243985    1.115255       6.54      11.35

.                 gen time =(year-1990)/10

.                 keep if year==min
(1,814 observations deleted)

.                 
.                 local var = "ivdem ld l1polar l1supdem ipi wealth"

.                 foreach v of local var {
  2.                         qui sum `v'
  3.                         qui replace `v'=(`v'-r(mean))/(r(sd))
  4.                 }

.                 replace wealth= wealth/.5
(578 real changes made)

.                 graph bar persparty,over(pubfin) 

.                 
.                 global d="pubfin"

.                 global c="ld ivdem l1polar ipi wealth"

.                 
.                 * Reduces selection into Create party *
.                 ttest create,by(pubfin)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       0 |     162    .4506173    .0392129    .4990982    .3731794    .5280552
       1 |     315    .1968254    .0224378    .3982319    .1526779    .2409729
---------+--------------------------------------------------------------------
Combined |     477    .2830189    .0206471    .4509385    .2424482    .3235895
---------+--------------------------------------------------------------------
    diff |            .2537919    .0420614                .1711425    .3364413
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   6.0338
H0: diff = 0                                     Degrees of freedom =      475

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 1.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 0.0000

.                 reg create $d,cluster(lid)

Linear regression                               Number of obs     =        477
                                                F(1, 476)         =      31.60
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0712
                                                Root MSE          =     .43505

                                  (Std. err. adjusted for 477 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
      create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      pubfin |  -.2537919   .0451504    -5.62   0.000    -.3425107   -.1650731
       _cons |   .4506173   .0391739    11.50   0.000     .3736422    .5275923
------------------------------------------------------------------------------

.                 reghdfe create $d,a(cowcode year)cluster(lid)
(dropped 12 singleton observations)
(MWFE estimator converged in 9 iterations)

HDFE Linear regression                            Number of obs   =        465
Absorbing 2 HDFE groups                           F(   1,    352) =       6.18
Statistics robust to heteroskedasticity           Prob > F        =     0.0134
                                                  R-squared       =     0.4023
                                                  Adj R-squared   =     0.2122
                                                  Within R-sq.    =     0.0240
Number of clusters (lid)     =        465         Root MSE        =     0.3969

                                  (Std. err. adjusted for 465 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
      create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      pubfin |  -.3495172   .1405951    -2.49   0.013    -.6260293   -.0730051
       _cons |   .5090319   .0985087     5.17   0.000     .3152922    .7027716
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
     cowcode |        83           0          83     |
        year |        30           1          29     |
-----------------------------------------------------+

.                 reg create $d $c,cluster(lid)

Linear regression                               Number of obs     =        468
                                                F(6, 467)         =      14.45
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1426
                                                Root MSE          =     .42174

                                    (Std. err. adjusted for 468 clusters in lid)
--------------------------------------------------------------------------------
               |               Robust
        create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------+----------------------------------------------------------------
        pubfin |  -.1457879   .0577866    -2.52   0.012    -.2593419   -.0322338
            ld |  -.1231779   .0295836    -4.16   0.000    -.1813114   -.0650444
         ivdem |   .0109486   .0368944     0.30   0.767     -.061551    .0834482
l1polarization |   .0630638   .0206489     3.05   0.002     .0224875      .10364
           ipi |  -.0225409    .031873    -0.71   0.480    -.0851733    .0400914
        wealth |   .0262261   .0193837     1.35   0.177     -.011864    .0643161
         _cons |    .390911   .0431812     9.05   0.000     .3060574    .4757646
--------------------------------------------------------------------------------

.                 reghdfe create $d $c,a(cowcode year)cluster(lid)
(dropped 11 singleton observations)
(MWFE estimator converged in 10 iterations)

HDFE Linear regression                            Number of obs   =        457
Absorbing 2 HDFE groups                           F(   6,    340) =       6.34
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.4424
                                                  Adj R-squared   =     0.2521
                                                  Within R-sq.    =     0.0951
Number of clusters (lid)     =        457         Root MSE        =     0.3888

                                    (Std. err. adjusted for 457 clusters in lid)
--------------------------------------------------------------------------------
               |               Robust
        create | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------+----------------------------------------------------------------
        pubfin |  -.3645786   .1370099    -2.66   0.008    -.6340724   -.0950847
            ld |  -.0308318   .0604149    -0.51   0.610    -.1496659    .0880023
         ivdem |  -.0468871   .0846075    -0.55   0.580    -.2133072    .1195329
l1polarization |   .0758965   .0579347     1.31   0.191    -.0380591     .189852
           ipi |   .1572236    .098212     1.60   0.110     -.035956    .3504032
        wealth |  -.4564944   .1054667    -4.33   0.000    -.6639438    -.249045
         _cons |   .5767388   .0951065     6.06   0.000     .3896676    .7638101
--------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
     cowcode |        82           0          82     |
        year |        30           1          29     |
-----------------------------------------------------+

.                 
.                 * Public financing of election reduces selection in party personalism *
.                 centile persparty if pubfin~=.,centile(50)

                                                          Binom. interp.   
    Variable |       Obs  Percentile    Centile        [95% conf. interval]
-------------+-------------------------------------------------------------
   persparty |       477         50    .5449234        .5061877    .5449234

.                 local c = r(c_1)

.                 gen hipers = persparty>`c' if persparty~=.

.                 ttest hipers,by(pubfin)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       0 |     162    .6604938    .0373203      .47501    .5867934    .7341943
       1 |     315    .3333333    .0266029    .4721546    .2809909    .3856758
---------+--------------------------------------------------------------------
Combined |     477    .4444444    .0227756    .4974257    .3996914    .4891975
---------+--------------------------------------------------------------------
    diff |            .3271605    .0457427                .2372774    .4170435
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   7.1522
H0: diff = 0                                     Degrees of freedom =      475

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 1.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 0.0000

.                 
.                 reg persparty $d,cluster(lid)

Linear regression                               Number of obs     =        477
                                                F(1, 476)         =      66.53
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1257
                                                Root MSE          =     .21137

                                  (Std. err. adjusted for 477 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
   persparty | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      pubfin |  -.1688917   .0207054    -8.16   0.000    -.2095771   -.1282064
       _cons |   .6294148   .0170547    36.91   0.000      .595903    .6629267
------------------------------------------------------------------------------

.                 reghdfe persparty $d,a(cowcode year)cluster(lid)
(dropped 12 singleton observations)
(MWFE estimator converged in 9 iterations)

HDFE Linear regression                            Number of obs   =        465
Absorbing 2 HDFE groups                           F(   1,    352) =       4.45
Statistics robust to heteroskedasticity           Prob > F        =     0.0357
                                                  R-squared       =     0.5907
                                                  Adj R-squared   =     0.4604
                                                  Within R-sq.    =     0.0157
Number of clusters (lid)     =        465         Root MSE        =     0.1641

                                  (Std. err. adjusted for 465 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
   persparty | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      pubfin |  -.1163535   .0551805    -2.11   0.036    -.2248786   -.0078285
       _cons |   .5890476   .0374071    15.75   0.000      .515478    .6626172
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
     cowcode |        83           0          83     |
        year |        30           1          29     |
-----------------------------------------------------+

.                 reg persparty $d $c,cluster(lid)

Linear regression                               Number of obs     =        468
                                                F(6, 467)         =      33.86
                                                Prob > F          =     0.0000
                                                R-squared         =     0.2874
                                                Root MSE          =     .19138

                                    (Std. err. adjusted for 468 clusters in lid)
--------------------------------------------------------------------------------
               |               Robust
     persparty | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------+----------------------------------------------------------------
        pubfin |  -.0633016   .0239488    -2.64   0.008    -.1103623    -.016241
            ld |  -.0827876   .0120828    -6.85   0.000    -.1065311   -.0590442
         ivdem |   .0427833   .0147058     2.91   0.004     .0138856     .071681
l1polarization |   .0414145   .0094131     4.40   0.000     .0229171    .0599119
           ipi |  -.0459923   .0144034    -3.19   0.002    -.0742958   -.0176887
        wealth |   .0025471   .0089032     0.29   0.775    -.0149483    .0200424
         _cons |   .5704705   .0185022    30.83   0.000     .5341125    .6068284
--------------------------------------------------------------------------------

.                 est store fin1

.                 reghdfe persparty $d $c,a(cowcode year)cluster(lid)
(dropped 11 singleton observations)
(MWFE estimator converged in 10 iterations)

HDFE Linear regression                            Number of obs   =        457
Absorbing 2 HDFE groups                           F(   6,    340) =       3.62
Statistics robust to heteroskedasticity           Prob > F        =     0.0017
                                                  R-squared       =     0.6027
                                                  Adj R-squared   =     0.4672
                                                  Within R-sq.    =     0.0543
Number of clusters (lid)     =        457         Root MSE        =     0.1629

                                    (Std. err. adjusted for 457 clusters in lid)
--------------------------------------------------------------------------------
               |               Robust
     persparty | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------+----------------------------------------------------------------
        pubfin |   -.116013   .0552368    -2.10   0.036     -.224662   -.0073641
            ld |  -.0296643   .0264826    -1.12   0.263    -.0817547     .022426
         ivdem |   .0147505   .0335637     0.44   0.661    -.0512681    .0807691
l1polarization |   .0279765   .0227846     1.23   0.220      -.01684     .072793
           ipi |   .0424208   .0410651     1.03   0.302    -.0383528    .1231944
        wealth |  -.1229089   .0404232    -3.04   0.003    -.2024199   -.0433979
         _cons |   .6062807    .037482    16.18   0.000     .5325549    .6800066
--------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
     cowcode |        82           0          82     |
        year |        30           1          29     |
-----------------------------------------------------+

.                 est store fin2

. 
.                 label var ld `""Democracy" "age      " "'

.                 label var ivdem `""Democracy" "level     ""'

.                 label var $d `""{bf:Publicly}   " "{bf:financed}  " "{bf:campaigns}""'

.                 label var l1polar "Polarization"

.                 label var ipi  `""Party  " "system " "instit.  ""'

.                 label var wealth "GDP pc"

.                 label var time "Time trend"

. 
.                 coefplot (fin1, msymbol(T))  (fin2, msymbol(D))   , ///
>                         drop(_cons) order(pubfin) ///
>                         grid(glcolor(gs15))xline(0,lpattern(dash)) xlab(-.2(.1)0.1) ///
>                         xtitle(Coefficient estimates)  level(95 90) title("Publicly financed campaigns", ///
>                         size(medium)height(6))subtit("reduce selection into personalist ruling party",size(vsmall)
> )xsize(2) ysize(3.5) mlabel format(%9.2g) ///
>                         mlabsize(vsmall)mlabposition(2)mlabgap(*.65)legend(lab(3 "Pooled")  lab(6 "Within") ///
>                         size(vsmall)order(3 6)pos(5)col(1)ring(0)) ///
>                         note("One observation per each of 482 leaders in 82 countries",size(vsmall)pos(6)) 

.                 gr export "$dir\golden\T-Public-financing-pers-party.pdf",as(pdf)replace 
file C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\golden\T-Public-financing-pers-party.pdf
    saved as PDF format

.                 
.  
.  *************** The END *****************
.                 
.                 log close
      name:  <unnamed>
       log:  C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\Ch7.log
  log type:  text
 closed on:  12 Jul 2023, 12:55:10
--------------------------------------------------------------------------------------------------------------------
